package org.bud.data.bit.ask;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.bud.data.bit.check.CheckData;
import org.bud.data.bit.fmt.FmtData;
import org.bud.data.bit.fmt.FmtType;

import java.util.function.Function;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;

/**
 * @author shaun
 * @date 2024/7/21
 * @instruction
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FmtAsk{
    private FmtType type;

    private CheckData check;

    private UnaryOperator<?> fmt;

    private Supplier<?> defaultValueSupplier;

    public static FmtAsk of(
            FmtType type,CheckData check,
            UnaryOperator<?> fmt,
            Supplier<?> defaultValueSupplier){
        return new FmtAsk (type,check,fmt,defaultValueSupplier);
    }

    public static FmtAsk emtpy(){
        return new FmtAsk (FmtType.STRING,null,b -> b,() -> null);
    }
}
